package edu.ustb.efws.base.controller.form;

import edu.ustb.efws.base.domain.Reason;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.*;

@ApiModel("新增风险原因")
public class ReasonSaveForm {
    @NotNull
    @Min(0) @Max(1)
    @ApiModelProperty(value = "0代表电流和电压原因;1代表温度和湿度原因", required = true)
    private Integer type;
    @NotNull
    @Min(0) @Max(100)
    @ApiModelProperty(value = "下限报警分数", required = true)
    private Integer lowerScore;
    @NotNull
    @Min(0) @Max(100)
    @ApiModelProperty(value = "上限报警分数", required = true)
    private Integer upperScore;
    @Size(max = 255)
    @ApiModelProperty("原因")
    private String reason;
    @Size(max = 255)
    @ApiModelProperty("措施")
    private String measure;

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getLowerScore() {
        return lowerScore;
    }

    public void setLowerScore(Integer lowerScore) {
        this.lowerScore = lowerScore;
    }

    public Integer getUpperScore() {
        return upperScore;
    }

    public void setUpperScore(Integer upperScore) {
        this.upperScore = upperScore;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getMeasure() {
        return measure;
    }

    public void setMeasure(String measure) {
        this.measure = measure;
    }

    public Reason toDomain(){
        Reason t = new Reason();

        t.setType(type);
        t.setLowerScore(lowerScore);
        t.setUpperScore(upperScore);
        t.setMeasure(measure);
        t.setReason(reason);

        return t;
    }
}
